<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * TurmaAvaliacao filter form base class.
 *
 * @package    filters
 * @subpackage TurmaAvaliacao *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseTurmaAvaliacaoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'dt_avaliacao'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'id_disciplina'       => new sfWidgetFormDoctrineChoice(array('model' => 'Disciplina', 'add_empty' => true)),
      'id_turma_ano_letivo' => new sfWidgetFormDoctrineChoice(array('model' => 'TurmaAnoLetivo', 'add_empty' => true)),
      'id_avaliacao'        => new sfWidgetFormDoctrineChoice(array('model' => 'Avaliacao', 'add_empty' => true)),
      'st_turma_avaliacao'  => new sfWidgetFormFilterInput(),
      'created_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'deleted'             => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'dt_avaliacao'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'id_disciplina'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Disciplina', 'column' => 'id_disciplina')),
      'id_turma_ano_letivo' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'TurmaAnoLetivo', 'column' => 'id_turma_ano_letivo')),
      'id_avaliacao'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Avaliacao', 'column' => 'id_avaliacao')),
      'st_turma_avaliacao'  => new sfValidatorPass(array('required' => false)),
      'created_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'deleted'             => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('turma_avaliacao_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'TurmaAvaliacao';
  }

  public function getFields()
  {
    return array(
      'id_turma_avaliacao'  => 'Number',
      'dt_avaliacao'        => 'Date',
      'id_disciplina'       => 'ForeignKey',
      'id_turma_ano_letivo' => 'ForeignKey',
      'id_avaliacao'        => 'ForeignKey',
      'st_turma_avaliacao'  => 'Text',
      'created_at'          => 'Date',
      'updated_at'          => 'Date',
      'deleted'             => 'Boolean',
    );
  }
}